package com.lxw.weather.model;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 生活指数
 */
public class LifeIndex implements Parcelable {
    private DressIndex dressIndex;     // 穿衣指数
    private UvIndex uvIndex;           // 紫外线指数
    private ColdIndex coldIndex;       // 感冒指数
    private CarWashIndex carWashIndex; // 洗车指数
    private SportIndex sportIndex;     // 运动指数
    private AllergyIndex allergyIndex; // 过敏指数

    // 构造方法
    public LifeIndex() {
    }

    public LifeIndex(DressIndex dressIndex, UvIndex uvIndex, ColdIndex coldIndex,
                     CarWashIndex carWashIndex, SportIndex sportIndex, AllergyIndex allergyIndex) {
        this.dressIndex = dressIndex;
        this.uvIndex = uvIndex;
        this.coldIndex = coldIndex;
        this.carWashIndex = carWashIndex;
        this.sportIndex = sportIndex;
        this.allergyIndex = allergyIndex;
    }

    // Getter和Setter方法
    public DressIndex getDressIndex() {
        return dressIndex;
    }

    public void setDressIndex(DressIndex dressIndex) {
        this.dressIndex = dressIndex;
    }

    public UvIndex getUvIndex() {
        return uvIndex;
    }

    public void setUvIndex(UvIndex uvIndex) {
        this.uvIndex = uvIndex;
    }

    public ColdIndex getColdIndex() {
        return coldIndex;
    }

    public void setColdIndex(ColdIndex coldIndex) {
        this.coldIndex = coldIndex;
    }

    public CarWashIndex getCarWashIndex() {
        return carWashIndex;
    }

    public void setCarWashIndex(CarWashIndex carWashIndex) {
        this.carWashIndex = carWashIndex;
    }

    public SportIndex getSportIndex() {
        return sportIndex;
    }

    public void setSportIndex(SportIndex sportIndex) {
        this.sportIndex = sportIndex;
    }

    public AllergyIndex getAllergyIndex() {
        return allergyIndex;
    }

    public void setAllergyIndex(AllergyIndex allergyIndex) {
        this.allergyIndex = allergyIndex;
    }

    @Override
    public String toString() {
        return "LifeIndex{" +
                "dressIndex=" + dressIndex +
                ", uvIndex=" + uvIndex +
                ", coldIndex=" + coldIndex +
                ", carWashIndex=" + carWashIndex +
                ", sportIndex=" + sportIndex +
                ", allergyIndex=" + allergyIndex +
                '}';
    }

    // Parcelable实现
    protected LifeIndex(Parcel in) {
        dressIndex = in.readParcelable(DressIndex.class.getClassLoader());
        uvIndex = in.readParcelable(UvIndex.class.getClassLoader());
        coldIndex = in.readParcelable(ColdIndex.class.getClassLoader());
        carWashIndex = in.readParcelable(CarWashIndex.class.getClassLoader());
        sportIndex = in.readParcelable(SportIndex.class.getClassLoader());
        allergyIndex = in.readParcelable(AllergyIndex.class.getClassLoader());
    }

    public static final Creator<LifeIndex> CREATOR = new Creator<LifeIndex>() {
        @Override
        public LifeIndex createFromParcel(Parcel in) {
            return new LifeIndex(in);
        }

        @Override
        public LifeIndex[] newArray(int size) {
            return new LifeIndex[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeParcelable(dressIndex, flags);
        dest.writeParcelable(uvIndex, flags);
        dest.writeParcelable(coldIndex, flags);
        dest.writeParcelable(carWashIndex, flags);
        dest.writeParcelable(sportIndex, flags);
        dest.writeParcelable(allergyIndex, flags);
    }

    // 穿衣指数内部类
    public static class DressIndex implements Parcelable {
        private String state;  // 指数状态
        private String reply;  // 建议

        public DressIndex() {
        }

        public DressIndex(String state, String reply) {
            this.state = state;
            this.reply = reply;
        }

        protected DressIndex(Parcel in) {
            state = in.readString();
            reply = in.readString();
        }

        public static final Creator<DressIndex> CREATOR = new Creator<DressIndex>() {
            @Override
            public DressIndex createFromParcel(Parcel in) {
                return new DressIndex(in);
            }

            @Override
            public DressIndex[] newArray(int size) {
                return new DressIndex[size];
            }
        };

        public String getState() {
            return state;
        }

        public void setState(String state) {
            this.state = state;
        }

        public String getReply() {
            return reply;
        }

        public void setReply(String reply) {
            this.reply = reply;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(state);
            dest.writeString(reply);
        }
    }

    // 紫外线指数内部类
    public static class UvIndex implements Parcelable {
        private String state;
        private String reply;

        public UvIndex() {
        }

        public UvIndex(String state, String reply) {
            this.state = state;
            this.reply = reply;
        }

        protected UvIndex(Parcel in) {
            state = in.readString();
            reply = in.readString();
        }

        public static final Creator<UvIndex> CREATOR = new Creator<UvIndex>() {
            @Override
            public UvIndex createFromParcel(Parcel in) {
                return new UvIndex(in);
            }

            @Override
            public UvIndex[] newArray(int size) {
                return new UvIndex[size];
            }
        };

        public String getState() {
            return state;
        }

        public void setState(String state) {
            this.state = state;
        }

        public String getReply() {
            return reply;
        }

        public void setReply(String reply) {
            this.reply = reply;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(state);
            dest.writeString(reply);
        }
    }

    // 感冒指数内部类
    public static class ColdIndex implements Parcelable {
        private String state;
        private String reply;

        public ColdIndex() {
        }

        public ColdIndex(String state, String reply) {
            this.state = state;
            this.reply = reply;
        }

        protected ColdIndex(Parcel in) {
            state = in.readString();
            reply = in.readString();
        }

        public static final Creator<ColdIndex> CREATOR = new Creator<ColdIndex>() {
            @Override
            public ColdIndex createFromParcel(Parcel in) {
                return new ColdIndex(in);
            }

            @Override
            public ColdIndex[] newArray(int size) {
                return new ColdIndex[size];
            }
        };

        public String getState() {
            return state;
        }

        public void setState(String state) {
            this.state = state;
        }

        public String getReply() {
            return reply;
        }

        public void setReply(String reply) {
            this.reply = reply;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(state);
            dest.writeString(reply);
        }
    }

    // 洗车指数内部类
    public static class CarWashIndex implements Parcelable {
        private String state;
        private String reply;

        public CarWashIndex() {
        }

        public CarWashIndex(String state, String reply) {
            this.state = state;
            this.reply = reply;
        }

        protected CarWashIndex(Parcel in) {
            state = in.readString();
            reply = in.readString();
        }

        public static final Creator<CarWashIndex> CREATOR = new Creator<CarWashIndex>() {
            @Override
            public CarWashIndex createFromParcel(Parcel in) {
                return new CarWashIndex(in);
            }

            @Override
            public CarWashIndex[] newArray(int size) {
                return new CarWashIndex[size];
            }
        };

        public String getState() {
            return state;
        }

        public void setState(String state) {
            this.state = state;
        }

        public String getReply() {
            return reply;
        }

        public void setReply(String reply) {
            this.reply = reply;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(state);
            dest.writeString(reply);
        }
    }

    // 运动指数内部类
    public static class SportIndex implements Parcelable {
        private String state;
        private String reply;

        public SportIndex() {
        }

        public SportIndex(String state, String reply) {
            this.state = state;
            this.reply = reply;
        }

        protected SportIndex(Parcel in) {
            state = in.readString();
            reply = in.readString();
        }

        public static final Creator<SportIndex> CREATOR = new Creator<SportIndex>() {
            @Override
            public SportIndex createFromParcel(Parcel in) {
                return new SportIndex(in);
            }

            @Override
            public SportIndex[] newArray(int size) {
                return new SportIndex[size];
            }
        };

        public String getState() {
            return state;
        }

        public void setState(String state) {
            this.state = state;
        }

        public String getReply() {
            return reply;
        }

        public void setReply(String reply) {
            this.reply = reply;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(state);
            dest.writeString(reply);
        }
    }

    // 过敏指数内部类
    public static class AllergyIndex implements Parcelable {
        private String state;
        private String reply;

        public AllergyIndex() {
        }

        public AllergyIndex(String state, String reply) {
            this.state = state;
            this.reply = reply;
        }

        protected AllergyIndex(Parcel in) {
            state = in.readString();
            reply = in.readString();
        }

        public static final Creator<AllergyIndex> CREATOR = new Creator<AllergyIndex>() {
            @Override
            public AllergyIndex createFromParcel(Parcel in) {
                return new AllergyIndex(in);
            }

            @Override
            public AllergyIndex[] newArray(int size) {
                return new AllergyIndex[size];
            }
        };

        public String getState() {
            return state;
        }

        public void setState(String state) {
            this.state = state;
        }

        public String getReply() {
            return reply;
        }

        public void setReply(String reply) {
            this.reply = reply;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(state);
            dest.writeString(reply);
        }
    }
}